﻿@page
@model CoreRp.Pages.admin.system.user.editModel
@{
    ViewData["title"] = "用户编辑";
}


<form class="layui-form" lay-filter="ftform" style="padding:7px">
    <!-- 提示：如果你不想用form，你可以换成div等任何一个普通元素 -->
    <div class="layui-form-item">
        <label class="layui-form-label">登陆名</label>
        <div class="layui-input-block">
            <input type="text" name="LOGINNAME" placeholder="请输入" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">密码</label>
        <div class="layui-input-block">
            <input type="text" name="PASSWORD" placeholder="请输入" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">真实姓名</label>
        <div class="layui-input-block">
            <input type="text" name="REALNAME" placeholder="请输入" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">昵称</label>
        <div class="layui-input-block">
            <input type="text" name="NICKNAME" placeholder="请输入" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">性别</label>
        <div class="layui-input-block">
            <select name="SEX" lay-filter="aihao">
                <option value="男">男</option>
                <option value="女">女</option>
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">企业</label>
        <div class="layui-input-block">
            <select name="COMPANYCODE" lay-filter="aihao">
                <option value="SUPER">超级企业</option>
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">是否可用</label>
        <div class="layui-input-block">
            <input type="radio" name="ENABLE" value="Y" title="可用">
            <input type="radio" name="ENABLE" value="N" title="不可用" checked>
        </div>
    </div>
    @*<div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="*">立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>*@
    <div class="layui-form-item" style="text-align:center">
        <button type="button" class="layui-btn" onclick="CloseHere()" style="margin-right:77px">提交</button>
        <button type="button" class="layui-btn">取消</button>
    </div>
</form>

@section Scripts{
    <script>
        let form;
        layui.use('form', function () {
            form = layui.form;

            //各种基于事件的操作，下面会有进一步介绍
        });
        function CloseHere() {
            var m = form.val("ftform");

            ax({
                url: 'api/user',
                data: m,
                method: 'post'
            }).then(resp => {
                var index = parent.layer.getFrameIndex(window.name); //获取当前窗口的name
                parent.layer.close(index);		//关闭窗口

            }).catch(err => {
                alert(JSON.stringify(err));
            })

            return;
            $.postJSON( window.basepath + 'api/user',m,
                d => {
                    var index = parent.layer.getFrameIndex(window.name); //获取当前窗口的name
                    parent.layer.close(index);		//关闭窗口
                },
                e => {
                    alert(JSON.stringify(e));
                }
            )
        }
    </script>
}